package com.xcity.pomelo.response;

import java.util.List;

import com.xcity.db.entity.Player;
import com.xcity.game.financial.PlayerFinancial;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class ReceiveFinancialInterestResponse extends Response {

	protected int id; // 理财产品id
	protected long availableInterest; // 已领取的利息
	
	public ReceiveFinancialInterestResponse(int serial, int id, Player player) {
		super(serial);
		this.id = id;
		long got = 0;
		List<PlayerFinancial> srcs = player.getFinancials().getFinancials();
		for (int i = 0, size = srcs.size(); i < size; i++) {
			PlayerFinancial pf = srcs.get(i);
			if (pf.getId() == id) {
				got += pf.getInterestGot();
			}
		}
		availableInterest += got;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public long getAvailableInterest() {
		return availableInterest;
	}

	public void setAvailableInterest(long availableInterest) {
		this.availableInterest = availableInterest;
	}
	
}
